<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<title>管理员界面-选课列表</title>
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta name="description" content="">
		<meta name="author" content="">

		<!-- Le styles -->
		<link href="resources/css/bootstrap.css" rel="stylesheet">
		<link href="resources/css/styles.css" rel="stylesheet">
		<link href="resources/css/bootstrap-responsive.css" rel="stylesheet">
		<script src="resources/js/jquery.js"></script>
		<script>
	$(function() {
		$(".delete").click(function() {
			var r = confirm("确定删除 ?");
			if (r) {
				var tr = $(this).closest("tr");
				$.ajax({
					url : "selectDelete.do",
					type : "post",
					dataType : "json",
					data : {
						"courseId" : tr.data("bh")
					},
					success : function(json) {
						if (json) {
							window.location.reload();
						} else {
							alert("删除数据失败！");
						}
					}
				});
			}
		});
	});
</script>
	</head>

	<body>
		<%@include file="header.jsp"%>
		<div id="main" style="width: 1000px; margin: 0px auto;">
			<b>选课列表</b>
			<hr />
			<div id="course_select_list">
				<table class="table table-bordered table-striped">
					<thead>
						<tr>
							<th style="width: 50px;">
								编号
							</th>
							<th style="width: 150px;">
								课程名
							</th>
							<th style="width: 50px;">
								已选人数
							</th>
							<th style="width: 50px;">
								人数上限
							</th>
							<th style="width: 50px">
								操作
							</th>
						</tr>
					</thead>
					<tbody>
						<c:forEach items="${selectList}" var="selectionVO" varStatus="p">
							<tr  data-bh="${selectionVO.courseId}">
								<td>
									<a href="#">${p.count}</a>
								</td>
								<td>
									<a href="#">${selectionVO.courseName}</a>
								</td>
								<td>
									<a href="#">${selectionVO.num}</a>
								</td>
								<td>
									<a href="#">${selectionVO.max}</a>
								</td>
								<td>
									<input type="image" src="resources/css/img/del.png"
										class="delete" value="删除" style="_float: left;" />
								</td>
							</tr>
						</c:forEach>

					</tbody>
				</table>
			</div>
			<button type="submit"
				style="width: 100px; height: 35px; float: right">
				<b>提交</b>
			</button>
		</div>
	</body>
</html>